function e(e) {
    var t = new Date(e).getTime(), i = new Date(new Date().toLocaleDateString()).getTime() - 1;
    return i > t && i - t < 864e5 ? "昨天 " + e.split(":")[0].split(" ")[1] + ":" + e.split(":")[1] : i > t ? e.split(":")[0] + ":" + e.split(":")[1] : e.split(":")[0].split(" ")[1] + ":" + e.split(":")[1];
}

var t = 0, i = 0;

function formatTime(date) {
  var year = date.getFullYear()
  var month = date.getMonth() + 1
  var day = date.getDate()

  var hour = date.getHours()
  var minute = date.getMinutes()
  var second = date.getSeconds()


  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
function formatNumber(n) {
  n = n.toString()
  return n[1] ? n : '0' + n
}
module.exports = {
    getHistoryTimer: function(r) {
      var t = formatTime(new Date(r));
      return 0 == i || r - i > 12e4 ? (i = r, e(t)) : null;
    },
    getHistoryTimer2: function (t) {
      t = t.replace(/-/gi, "/").split(".")[0];
      var r = new Date(t).getTime();
      return 0 == i || r - i > 12e4 ? (i = r, e(t)) : null;
    },
    getChatTimer: function(i) {
        i = i.replace(/-/gi, "/").split(".")[0];
        var r = new Date(i).getTime(), n = e(i);
        return 0 != t && r - t < 12e4 && (t = r, n = ""), t = r, n;
    },
    history_reset: function() {
        i = 0;
    },
    reset: function() {
        t = 0, i = 0;
    }
};